//
//  OSTextField.m
//  百思不得姐
//
//  Created by PushMeBaby on 16/2/24.
//  Copyright © 2016年 CoderC. All rights reserved.
//

#import "OSTextField.h"


@interface OSTextField ()



@end


@implementation OSTextField


static NSString *const OSPlacerholderColorKeyPath = @"_placeholderLabel.textColor";

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


-(void)awakeFromNib{
    self.tintColor = self.textColor;
    
    [self resignFirstResponder];
}


-(BOOL)becomeFirstResponder{
    
    [self setValue:self.textColor forKeyPath:OSPlacerholderColorKeyPath];
    
    
    return [super becomeFirstResponder];
}

-(BOOL)resignFirstResponder{
    
    
    [self setValue:[UIColor grayColor] forKeyPath:OSPlacerholderColorKeyPath];
    return [super resignFirstResponder];
}
@end
